/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};

/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {

/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;

/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			exports: {},
/******/ 			id: moduleId,
/******/ 			loaded: false
/******/ 		};

/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ 		// Flag the module as loaded
/******/ 		module.loaded = true;

/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}


/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;

/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;

/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";

/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({

/***/ 0:
/***/ function(module, exports, __webpack_require__) {

	var InputNumber = __webpack_require__(20);
	var Root = React.createClass({displayName: "Root",
	    click: function () {
	        alert(this.refs.inputnumber.getValue())
	    },
	    render: function () {
	        return (
	            React.createElement("div", null, 

	                React.createElement(InputNumber, {step: "500", max: "5000", min: "1", value: "2000", ref: "inputnumber"}
	                ), 
	                React.createElement("br", null), 
	                React.createElement("br", null), 
	                React.createElement("button", {onclick: this.click.bind(this)}, "取值")
	            )
	        )
	    }
	});

	ReactDOM.render(React.createElement(Root, null), document.getElementById('main'));

/***/ },

/***/ 20:
/***/ function(module, exports) {

	
	var InputNumber = React.createClass({displayName: "InputNumber",
	    getDefaultProps: function () {
	        return {
	            min: "",
	            max: "",
	            value: "",
	            step: "",
	            onChange: "",
	            disabled: "",
	            className: "",
	            id: ""
	        }
	    },
	    getInitialState: function () {
	        return {
	            value: this.props.value,
	            classNameAdd: "",
	            classNameLess: ""
	        }
	    },
	    componentDidMount: function(){
	        this.refs.inputnumber.value=this.props.value;
	    },
	    handelAdd: function () {
	        var v = parseInt(this.refs.inputnumber.value) + parseInt(this.props.step);
	        this.refs.less.className = "less";
	        this.refs.inputnumber.value = v;
	        if (v >= parseInt(this.props.max)) {
	            this.refs.add.className = "add disabled";
	            this.refs.inputnumber.value = this.props.max;
	        }
	        this.props.onChange ? this.props.onChange(this.refs.inputnumber.value) : "";
	    },
	    handelLess: function () {
	        var v = parseInt(this.refs.inputnumber.value) - parseInt(this.props.step);
	        this.refs.add.className = "add";
	        this.refs.inputnumber.value = v;
	        if (v <= parseInt(this.props.min)) {
	            this.refs.less.className = "less disabled";
	            this.refs.inputnumber.value = this.props.min;
	        }
	        this.props.onChange ? this.props.onChange(this.refs.inputnumber.value) : "";
	    },
	    handleChange: function (e) {
	        var v = e.target.value;
	        this.refs.less.className = "less";
	        this.refs.add.className = "add";
	        if (v > parseInt(this.props.max)) {
	            v = this.props.max;
	            this.refs.add.className = "add disabled";
	        } else if (v < parseInt(this.props.min)) {
	            v = this.props.min;
	            this.refs.less.className = "less disabled";
	        }
	        if (!isNaN(v)) {
	            this.refs.inputnumber.value=v;
	        } else {
	            this.refs.inputnumber.value = "";
	        }

	        this.props.onChange ? this.props.onChange(this.refs.inputnumber.value) : "";
	    },
	    getValue: function(){
	        return this.refs.inputnumber.value;
	    },
	    render: function () {
	        return (
	            React.createElement("div", {className: this.props.className?"ucs-input-number "+this.props.className:"ucs-input-number", id: this.props.id}, 
	                React.createElement("a", {className: this.state.classNameLess?"less "+this.state.classNameLess:"less", onclick: this.handelLess.bind(this), ref: "less"}), 
	                React.createElement("input", {onchange: this.handleChange.bind(this), className: "ucs-input", ref: "inputnumber"}), 
	                React.createElement("a", {className: this.state.classNameAdd?"add "+this.state.classNameAdd:"add", onclick: this.handelAdd.bind(this), ref: "add"})
	            )
	        )
	    }
	});
	module.exports = InputNumber;


/***/ }

/******/ });